# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: jiangxq <jiangxueqian at gmail dot com>
# Contributor: zh99998 <zh99998@gmail.com>
# Contributor: 4679kun <admin at 4679 dot us>

pkgname=simple-obfs
pkgver=0.0.5
pkgrel=3
pkgdesc='A simple obfusacting tool designed as plugin server of shadowsocks'
arch=('loong64' 'x86_64')
url='https://github.com/shadowsocks/simple-obfs'
license=('GPL')
depends=('libev' 'libcork')
makedepends=('asciidoc' 'xmlto')
source=("$pkgname-$pkgver.tar.gz::https://github.com/shadowsocks/simple-obfs/archive/v$pkgver.tar.gz"
        $pkgname-gcc-9.patch::https://github.com/shadowsocks/simple-obfs/pull/252.patch)
sha512sums=('aadb812d5a57fea664958b66aae0c5be5e82309758706181ed5f1c76a986c1a6eaa82a6cb8b242052a951dd2d9d178d734f04052be887b5dd8f336808db61bcb'
            'a96f2ec88229ca1d4850fbccc76958945e4cade3c5ae4ec3849c36909220ee66a9c13b8818614426421f0c340c8cae40b8232137a44c35672061103dab8da3c9')

prepare() {
  cd simple-obfs-$pkgver
  patch -p1 -i debian/patches/0001-Use-libcork-dev-in-system.patch
  patch -p1 -i ../$pkgname-gcc-9.patch

  sed -i 's/-Werror//' configure.ac src/Makefile.am
}

build() {
  cd simple-obfs-$pkgver
  ./autogen.sh
  ./configure --prefix=/usr
  make
}

package() {
  cd simple-obfs-$pkgver
  make DESTDIR="$pkgdir" install
}
